﻿@using System.Globalization
@using Abp.Configuration
@using Abp.Configuration.Startup
@using Abp.Web.Mvc.Alerts
@using Abp.Web.Security.AntiForgery
@using MPACore.Phonebook
@using MPACore.Phonebook.Configuration
@using MPACore.Phonebook.Web.Resources
@using MPACore.Phonebook.Web.Views.Shared.Components.SideBarNav
@using MPACore.Phonebook.Web.Views.Shared.Components.SideBarUserArea
@using MPACore.Phonebook.Web.Views.Shared.Components.TopBarLanguageSwitch
@using MPACore.Phonebook.Web.Views.Shared.Components.RightSideBar
@inject MPACore.Phonebook.Timing.AppTimes AppTimes
@inject IAbpAntiForgeryManager AbpAntiForgeryManager
@inject IMultiTenancyConfig MultiTenancyConfig
@inject IWebResourceManager WebResourceManager
@inject ISettingManager SettingManager
@inject IAlertManager AlertManager
@{
    Layout = null;
    AbpAntiForgeryManager.SetCookie(Context);
    var uiTheme = await SettingManager.GetSettingValueAsync(AppSettingNames.UiTheme);
}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta name="description" content="">
    <meta name="author" content="">

    <link rel="shortcut icon" href="~/favicon.ico">

    <title>Phonebook</title>

    <environment names="Development">
        <link href="~/fonts/roboto/roboto.css" rel="stylesheet" asp-append-version="true" />
        <link href="~/fonts/material-icons/materialicons.css" rel="stylesheet" asp-append-version="true" />
        <link href="~/lib/bootstrap/dist/css/bootstrap.css" rel="stylesheet" asp-append-version="true" />
        <link href="~/lib/bootstrap-select/dist/css/bootstrap-select.css" rel="stylesheet" asp-append-version="true" />
        <link href="~/lib/toastr/toastr.css" rel="stylesheet" asp-append-version="true" />
        <link href="~/lib/famfamfam-flags/dist/sprite/famfamfam-flags.css" rel="stylesheet" asp-append-version="true" />
        <link href="~/lib/font-awesome/css/font-awesome.css" rel="stylesheet" asp-append-version="true" />
        <link href="~/lib/Waves/dist/waves.css" rel="stylesheet" asp-append-version="true" />
        <link href="~/lib/animate.css/animate.css" rel="stylesheet" asp-append-version="true" />
        <link href="~/css/materialize.css" rel="stylesheet" asp-append-version="true" />
        <link href="~/css/style.css" rel="stylesheet" asp-append-version="true">
        <link href="~/css/themes/all-themes.css" rel="stylesheet" asp-append-version="true" />
        <link href="~/view-resources/Views/Shared/_Layout.css" rel="stylesheet" asp-append-version="true" />
    </environment>

    <environment names="Staging,Production">
        <link href="~/view-resources/Views/_Bundles/shared-layout.min.css" rel="stylesheet" asp-append-version="true" />
    </environment>

    <!-- View specific styles -->
    @RenderSection("styles", required: false)

    <script type="text/javascript">
        // This is used to get the application's root path from javascript. It's useful if you're running application in a virtual directory under IIS.
        var abp = abp || {};
        abp.appPath = '@ApplicationPath';
    </script>

</head>
<body class="@("theme-" + uiTheme)">

    <!-- Page Loader -->
    <div class="page-loader-wrapper">
        <div class="loader">
            <div class="preloader">
                <div class="spinner-layer pl-red">
                    <div class="circle-clipper left">
                        <div class="circle"></div>
                    </div>
                    <div class="circle-clipper right">
                        <div class="circle"></div>
                    </div>
                </div>
            </div>
            <p>@L("PleaseWait")</p>
        </div>
    </div>
    <!-- #END# Page Loader -->
    <!-- Overlay For Sidebars -->
    <div class="overlay"></div>
    <!-- #END# Overlay For Sidebars -->
    <!-- Search Bar -->
    <div class="search-bar">
        <div class="search-icon">
            <i class="material-icons">search</i>
        </div>
        <input type="text" placeholder="@L("StartTyping")...">
        <div class="close-search">
            <i class="material-icons">close</i>
        </div>
    </div>
    <!-- #END# Search Bar -->
    <!-- Top Bar -->
    <nav class="navbar">
        <div class="container-fluid">
            <div class="navbar-header">
                <a href="javascript:void(0);" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false"></a>
                <a href="javascript:void(0);" class="bars"></a>
                <a class="navbar-brand" asp-controller="Home" asp-action="Index"><i class="fa fa-cubes"></i> Phonebook</a>
            </div>
            <div class="collapse navbar-collapse" id="navbar-collapse">
                <ul class="nav navbar-nav navbar-right">
                    <!-- Call Search -->
                    <li><a href="javascript:void(0);" class="js-search" data-close="true"><i class="material-icons">search</i></a></li>
                    <!-- #END# Call Search -->

                    @await Component.InvokeAsync(typeof(TopBarLanguageSwitchViewComponent))

                    <li class="pull-right"><a href="javascript:void(0);" class="js-right-sidebar" data-close="true"><i class="material-icons">more_vert</i></a></li>
                </ul>
            </div>
        </div>
    </nav>
    <!-- #Top Bar -->
    <section>
        <aside id="leftsidebar" class="sidebar">

            @await Component.InvokeAsync(typeof(SideBarUserAreaViewComponent))
            @await Component.InvokeAsync(typeof(SideBarNavViewComponent), new { activeMenu = ViewBag.CurrentPageName })

            <!-- Footer -->
            <div class="legal">
                <div class="copyright">
                    &copy; @DateTime.Now.Year <a href="javascript:void(0);">Phonebook</a>.
                </div>
                <div class="version">
                    <b>@L("Version") </b> @AppVersionHelper.Version [@AppVersionHelper.ReleaseDate.ToString("yyyyMMdd")]
                </div>
            </div>
            <!-- #Footer -->
        </aside>

        @await Component.InvokeAsync(typeof(RightSideBarViewComponent))

    </section>

    <section class="content">
        <div class="container-fluid">
            @if (AlertManager.Alerts.Any())
            {
                <div id="AbpPageAlerts">
                    @foreach (var alertMessage in AlertManager.Alerts)
                    {
                        <div class="alert alert-@alertMessage.Type.ToString().ToLower() @(alertMessage.Dismissible ? "alert-dismisable" : "")" role="alert">
                            <h4 class="alert-heading">
                                @alertMessage.Title
                                @if (alertMessage.Dismissible)
                                {
                                    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                }
                            </h4>
                            <p>@alertMessage.Text</p>
                        </div>
                    }
                </div>
            }

            @RenderBody()
        </div>
    </section>

    <environment names="Development">
        <script src="~/lib/json2/json2.js" asp-append-version="true"></script>
        <script src="~/lib/jquery/dist/jquery.js" asp-append-version="true"></script>
        <script src="~/lib/bootstrap/dist/js/bootstrap.js" asp-append-version="true"></script>
        <script src="~/lib/moment/min/moment-with-locales.js" asp-append-version="true"></script>
        <script src="~/lib/jquery-validation/dist/jquery.validate.js" asp-append-version="true"></script>
        <script src="~/lib/blockUI/jquery.blockUI.js" asp-append-version="true"></script>
        <script src="~/lib/toastr/toastr.js" asp-append-version="true"></script>
        <script src="~/lib/sweetalert/dist/sweetalert.min.js" asp-append-version="true"></script>
        <script src="~/lib/spin.js/spin.js" asp-append-version="true"></script>
        <script src="~/lib/spin.js/jquery.spin.js" asp-append-version="true"></script>
        <script src="~/lib/bootstrap-select/dist/js/bootstrap-select.js" asp-append-version="true"></script>
        <script src="~/lib/jquery-slimscroll/jquery.slimscroll.js" asp-append-version="true"></script>
        <script src="~/lib/Waves/dist/waves.js" asp-append-version="true"></script>
        <script src="~/lib/push.js/push.js" asp-append-version="true"></script>
        <script src="~/lib/abp-web-resources/Abp/Framework/scripts/abp.js" asp-append-version="true"></script>
        <script src="~/lib/abp-web-resources/Abp/Framework/scripts/libs/abp.jquery.js" asp-append-version="true"></script>
        <script src="~/lib/abp-web-resources/Abp/Framework/scripts/libs/abp.toastr.js" asp-append-version="true"></script>
        <script src="~/lib/abp-web-resources/Abp/Framework/scripts/libs/abp.blockUI.js" asp-append-version="true"></script>
        <script src="~/lib/abp-web-resources/Abp/Framework/scripts/libs/abp.spin.js" asp-append-version="true"></script>
        <script src="~/lib/abp-web-resources/Abp/Framework/scripts/libs/abp.sweet-alert.js" asp-append-version="true"></script>
        <script src="~/js/admin.js" asp-append-version="true"></script>
        <script src="~/js/main.js" asp-append-version="true"></script>
        <script src="~/view-resources/Views/Shared/_Layout.js" asp-append-version="true"></script>

        @if (CultureInfo.CurrentUICulture.Name != "en")
        {
            <script src="~/lib/jquery-validation/src/localization/messages_@Html.Raw(CultureInfo.CurrentUICulture.Name.Replace("-", "_") + ".js")" asp-append-version="true"></script>
        }
    </environment>

    <environment names="Staging,Production">
        <script src="~/view-resources/Views/_Bundles/shared-layout.min.js" asp-append-version="true"></script>
    </environment>

    <script>
    // Localizing momentjs
    moment.locale('@CultureInfo.CurrentUICulture.Name');
    </script>

    <!-- Dynamic scripts of ABP system (They are created on runtime and can not be bundled) -->
    <script src="~/AbpServiceProxies/GetAll?v=@(AppTimes.StartupTime.Ticks)" type="text/javascript"></script>
    <script src="~/AbpScripts/GetScripts?v=@(AppTimes.StartupTime.Ticks)" type="text/javascript"></script>

    <script src="~/lib/signalr-client/signalr.min.js" asp-append-version="true"></script>
    <script src="~/lib/abp-web-resources/Abp/Framework/scripts/libs/abp.signalr-client.js" asp-append-version="true"></script>

    @WebResourceManager.RenderScripts()

    <!-- View specific scripts -->
    @RenderSection("scripts", required: false)
</body>
</html>
